<template>
  <div class="tab-bar-item">
    <div v-if="!isActive" ><slot name="item-icon"></slot></div>
    <div v-else><slot name="item-icon-active"></slot></div>
    <!-- 将插槽用div包裹防止呗替换，把属性写在div中 -->
    <div :class="{active: isActive}"><slot name="item-text"></slot></div>
  </div>
  <!-- <div class="tab-bar-item">
    <img src="../assets/img/tabbar/shopcart.svg" alt="">
    <div>购物车</div>
  </div> -->
  <!-- <div class="tab-bar-item">
    <img src="../assets/img/tabbar/category.svg" alt="">
    <p>分类</p>
  </div>
  <div class="tab-bar-item">
    <img src="../assets/img/tabbar/profile.svg" alt="">
    <p>我的</p>
  </div> -->
</template>

<script>
export default {
  name: 'TabBarItem',
  data(){
    return{
      isActive: true
    }
  }
}
</script>

<style>
  .tab-bar-item {
    flex: 1;
    text-align: center;
    height: 49px;
    /* line-height: 49px; */
    font-size: 14px;
  }
  .tab-bar-item img {
    height: 24px;
    width: 24px;
    margin-top: 3px;
    vertical-align: middle;
  }
  .active {
    color: red;
  }
</style>